const mime = require('mime');
 var img='1.png';
console.log(mime.getType(img));                    // ⇨ 'text/plain'
console.log(mime.getExtension('image/png')); 